<?php
namespace Home\Controller;
use Think\Controller;
class AddressController extends Controller {
    public function address()
    {
        $data = I('get.');
        $info = query_address($data['uid']);
        kuayu();
        echo json_encode($info);
    }
    public function now_address()
    {
        $data = I('get.');
        $info  = D('Users_address')->find($data['id']);
        kuayu();
        echo json_encode($info);
    }
    public function add_address()
    {
        $data = I('get.');
        $address = D('Users_address');
        $id = $address->max('id');
        $data['id'] = $id+1;
        $z = $address->add($data);
    }
    public function edit_address()
    {
        $data = I('get.');
        $z = D('Users_address')->save($data);
    }
    public function delete_address()
    {
        $data = I('get.');
        $z = D('Users_address')->delete($data['id']);
    }
    public function default_address()
    {
        $data = I('get.');
        $z = D('Users')->where('id='.$data['user_id'])->setField('address_id',$data['id']);
    }


}